<template>
    <div>
        user模块:
        <p>姓名：{{ name }}</p> 
        <p>性别：{{ gender }}</p>
        <p>年龄：{{ age }}</p>
        <button @click="addAge">增加年龄</button>
    </div>
</template>

<script setup>
    import { useUserStore } from '../store/user'
    import { storeToRefs } from 'pinia'

    const user = useUserStore()
    const {name, gender, age} = storeToRefs(user)

    const addAge = () => {
        user.addAge()
    }
</script>